function space(str) {
  if (typeof str === 'string') {
    return str.replace(/(^\s*)|(\s*$)/g, "");
  }
  return str;
}

// 账户验证
function nameReg(str) {
  str = space(str);
  const reg = /^[a-zA-z]\w{2,15}$/;
  return reg.test(str)
}
// 特殊字符
function tszf(str) {
  str = space(str);
  const reg = /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/;
  return reg.test(str)
}
// 
function showText(str) {
  wx.showToast({
    title: str,
    icon: 'none',
    duration: 2000
  })
}
function doText(text,ob){
  let b = true
  if(!text){
    showText(ob.message)
  }else if(!tszf(text)){
    showText('不支持特殊字符')
  }else{
    b = false
  }
  return b
}
export function ruleFn(obj, rule) {
  let sbs = {},bt = true;
  for(let k in obj){
    if(rule[k]){
      sbs[k] = doText(obj[k],rule[k])
    }
  }
  for(let k in sbs){
    if(sbs[k]){
      bt = false
    }
  }
  return false
}